//
//  KKBLEConfig.h
//
//  Created by zorro on 2017/11/13.
//  Copyright © 2017年 zorro. All rights reserved.
//



#import <Foundation/Foundation.h>
#import "KKBLEType.h"

typedef enum {
    BLTModelDeviceX9 = 0,                   // X9
    BLTModelDeviceI6 = 1,                   // I6
    BLTModelDeviceSOne = 2,                 // ione
    BLTModelDeviceX10 = 3,
} BLTModelDeviceType;

// 设备宏
#define DEVICEX9 @"X9"
#define DEVICEI6 @"i6"
#define DEVICEIONE @"SOne"
#define DEVICEX10 @"X10pro"
#define DEVICEX1 @"X1pro"

// X9和I6的服务
#define KK_BLEServiceX9 [CBUUID UUIDWithString:@"8F400001-CFB4-14A3-F1BA-F61F35CDDBAF"]
#define KK_BLEServiceI6 [CBUUID UUIDWithString:@"0xfff0"]
#define KK_BLEServiceUpdate [CBUUID UUIDWithString:@"00001530-1212-EFDE-1523-785FEABCD123"]
#define KK_BLEServiceUpdateNRF82 [CBUUID UUIDWithString:@"FE59"]
#define KK_BLEServiceTW64 [CBUUID UUIDWithString:@"0xFF00"]
#define KK_BLEServiceUpdateFJW [CBUUID UUIDWithString:@"5833FF01-9B8B-5191-6142-22A4536EF123"]
@interface KKBLEConfig : NSObject

@property (nonatomic, strong) KKBLEModel *model;
// 蓝牙协议类型
@property (nonatomic, assign) KKBLEProtocol protocol;

@property (nonatomic, strong) CBUUID *service;
@property (nonatomic, strong) CBUUID *write;
@property (nonatomic, strong) CBUUID *notify;

// 此升级只针对nordic
@property (nonatomic, strong) CBUUID *updateService;
@property (nonatomic, strong) CBUUID *updateControl;
@property (nonatomic, strong) CBUUID *updatePacket;
@property (nonatomic, strong) CBUUID *updateVersion;

@property (nonatomic, assign) BOOL historyHeart;             // 历史心率
@property (nonatomic, assign) BOOL historyOxygen;            // 历史血氧
@property (nonatomic, assign) BOOL bistoryPressure;          // 历史血压
@property (nonatomic, assign) BLTModelDeviceType deviceType; // 暂时没用
@property (nonatomic, strong) NSString *bltName;

// 通过广播名匹配设备的蓝牙协议
+ (KKBLEConfig *)configWithModel:(KKBLEModel *)model;
// 通过设备名判断是否是APP相关产品
+ (BOOL)isFitDevice:(NSString *)name;
+ (BOOL)isFitAdv:(NSString *)adv;
// 包含不同方案的设备服务组
+ (NSArray *)deviceServices;
+ (NSArray *)deviceUpdateServices;
//服务的结合 X9 I6 目前 (包含升级服务)
+ (NSArray *)uartServiceUUIDAndUpdateService;
- (void)updateService:(int)adv;

@end

